<template>
  <div class="wrap">
    <div class="container">
      <div class="title">{{ info.title }}</div>
      <div class="info">
        发布时间：{{ info.publishtime_text }}
        <!-- | 发布着：征婚网 -->
      </div>
      <div class="content">
        <div class="images">
          <img
            @click="handlePictureCardPreview(img)"
            v-for="img in info.images"
            :key="img"
            :src="img"
            alt=""
          />
        </div>
        <p v-html="info.content"></p>
      </div>
    </div>
    <el-dialog :visible.sync="dialogVisible">
      <img width="100%" :src="dialogImageUrl" alt="" />
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "IndexView",
  data() {
    return { id: "", info: {}, dialogImageUrl: "", dialogVisible: false };
  },
  components: {},
  mounted() {
    this.id = this.$route.query.id;
    this.getInfo();
  },
  methods: {
    getInfo() {
      this.$post("cases/detail", { cases_id: this.id }).then((res) => {
        this.info = res.data;
      });
    },
    handlePictureCardPreview(url) {
      this.dialogImageUrl = url;
      this.dialogVisible = true;
    },
  },
};
</script>

<style scoped lang="scss">
.container {
  background: #fff;
  margin: 40px 0;
  border: 1px solid #ebebeb;
  padding: 40px;
}
.title {
  font-size: 30px;
  text-align: center;
}
.info {
  color: #999;
  font-size: 14px;
  border-bottom: 1px solid #ebebeb;
  text-align: center;
  padding: 25px 0;
}
.content {
  padding: 30px 0;
}
.images {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  img {
    width: 24%;
    margin-bottom: 10px;
  }
}
@media screen and (max-width: 768px) {
  .container {
    margin: 20px 0;
    padding: 20px;
  }
  .title {
    font-size: 20px;
  }
  .info {
    font-size: 12px;
    padding: 11px 0;
  }
  .content {
    padding: 20px 0;
  }
  .images {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    img {
      width: 49%;
      margin-bottom: 10px;
    }
  }
  :deep .el-dialog {
    width: 90%;
  }
}
</style>
